//
//  UIButton+Extension.swift
//  DXWeibo00
//
//  Created by xiongdexi on 16/4/7.
//  Copyright © 2016年 DXSmile. All rights reserved.
//  为UIButton拖展构造一个便利构造函数

import UIKit

extension UIButton {

/// 便利构造函数
    convenience init(imageName: String, backImageName: String) {
        self.init()
        
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        setBackgroundImage(UIImage(named: backImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: backImageName + "_highlighted"), forState: UIControlState.Highlighted)
        
        // 自适应尺寸
        sizeToFit()
        
    }

}
